package com.jgp.security.pojo;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * 项目   jgp-cloud-parent
 * 作者   loufei
 * 时间   2019-11-04
 */
@Getter
@Setter
public class PowerInfo implements Serializable {
    
    private Set<String> roles;
    private Set<String> resources;
    
    public PowerInfo() {
        this.roles = new HashSet<>();
        this.resources = new HashSet<>();
    }
    
    public void addRole(String role) {
        this.roles.add(role);
    }
    
    public void addAllRoles(Collection<String> roles) {
        this.roles.addAll(roles);
    }
    
    public void addResource(String resource) {
        this.resources.add(resource);
    }
    
    public void addAllResource(Collection<String> resources) {
        this.resources.addAll(resources);
    }
}
